package com.liwy3.job.config;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * Copyright © 元气森林（北京）食品科技集团有限公司. All rights reserved.
 *
 * @Description:
 * @author: Crazy4J
 * @date: 2021年12月23日 11:41
 * @version: V1.0
 */
@Component
@Slf4j
public class ShardDemoJob extends AbstractShardXxlJob<String> {


    @XxlJob("shardDemoJob")
    public void shardDemoJob() {
        List<String> shardList = new ArrayList<>();
        for (int i = 0; i < 32; i++) {
            shardList.add(i + "");
        }
        super.processShard(shardList);
    }

    @Override
    protected void processOne(String task) {
        log.info("执行任务:{}", task);
    }
}
